﻿CREATE  proc [dbo].[danhmucKH_Sua]
@masokh varchar(255),
@tenkh nvarchar(255),
@diachi nvarchar(255),
@sodienthoai nvarchar(255),
@mathuecu nvarchar(255),
@masokh_old varchar(255)
as
if exists(select * from DM_KhachHang  Where masokh <>@masokh  and tenkh =@tenkh   )
begin
select ErrCode=0
end
else
begin
update DM_KhachHang   set tenkh =@tenkh,diachi=@diachi,sodienthoa=@sodienthoai,mathuecu=@mathuecu 
 WHere masokh =@masokh_old 
 
select ErrCode=1
end